<?php
/**
 * Get Annotation configuration for any Controller
 * @author NgoAnhTu
 * @date 06/10/2013 
 */
class ControllerAnnotation extends Annotation {
	
	const ACTION = "action";
	const PERMIS = "permis";
	
	/**
	 * Get action method's name
	 * @param unknown_type $class
	 * @param unknown_type $action
	 */
	public function getAction($class, $action) {
		$result = null;
		
		$items = $this->getOfMethods($class);
		foreach ($items as $item) {
			if (isset($item[self::ACTION]) && $item[self::ACTION] == $action) {
				$result = new Object();
				$result->METHOD = $item[self::METHOD];
				if (isset($item[self::PERMIS])) {
					$result->PERMIS = $item[self::PERMIS];
				}
				break;
			}
		}
		
		return $result;
	}
	
}
?>